package net.lcheng.service.impl;

import net.lcheng.dao.SysUserRolesMapper;
import net.lcheng.model.SysUserRoles;
import net.lcheng.model.SysUserRolesExample;
import net.lcheng.service.SysUserRolesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by qiliping on 15/11/10.
 */
@Service("sysUserRolesService")
public class SysUserRolesServiceImpl implements SysUserRolesService {
    @Resource
    private SysUserRolesMapper dao;

    @Override
    public List<SysUserRoles> getUserRolesByUserName(String userName) {
        SysUserRolesExample example = new SysUserRolesExample();
        example.or().andUsernameEqualTo(userName);

        return dao.selectByExample(example);
    }

    @Override
    public List<SysUserRoles> getUserRolesByUserId(int userId) {
        SysUserRolesExample example = new SysUserRolesExample();
        example.or().andUserIdEqualTo(userId);

        return dao.selectByExample(example);
    }
}
